﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="Order_DistributeSettlementAmount" Codebehind="DistributeSettlementAmount.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript" src="../Include/Js/OpenWindow.js"></script>
    <script type="text/javascript" src="../Include/Js/SocanCode.js"></script>
    <script type="text/javascript" src="../Include/Js/PopupCalendar.js"></script>
    <script type="text/javascript" src="../Include/Js/calendar.js"></script>
<style type="text/css">
fieldset {width:96%;}
select {margin:0;padding:0;}
.hidden{visibility:hidden;}
body{padding:0; margin:0; background-color:#ffffff; text-align:center; font: "宋体"; font-size:12px;}
a:visited{text-decoration:none;color:slategray;}
a:hover{text-decoration:underline;color:slategray;}
a:link{text-decoration:none;color:slategray;}
.juli {margin-top:10px;padding-left:20px;}
.juli1 {margin-top:20px; margin-left:20px; text-align:left;}
.juli2 { margin:5px auto;}
.juli3 { margin-bottom:50px;}
.juli4 {padding-left:20px;padding-top:20px;padding-bottom:10px;background-color:#fef3bb;}
.juli5 {padding:0px; margin:0px;}
.z1{background-color:#e7e7e7; text-align:left; line-height:20px;}
.z2{background-color:#FFFFFF; text-align:left; line-height:20px;}
.input_button {width:52px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt.gif) no-repeat;}
.input_button1 {width:74px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt1.gif) no-repeat;}
.input_button2 {width:52px;height:23px;border:none;background:#ffffff url(../Include/Images/bt.gif) no-repeat; padding-top:5px;}
.input_button2 a{color:#000000;}
.input_button2 a:hover{color:#FF3300; text-decoration:underline;}
.input_button3 {width:95px;height:23px;border:none;background:#ffffff url(../Include/Images/bt2.gif) no-repeat;}
.zt1 {padding-left:10px; font-weight:600; color:#000000;}
.zt2 {padding-left:10px;}
.zt3 {text-align:center; font-weight:600; color:#000000;}
.zt4 {text-align:center; color:#000000;}
.zt5 {text-align:left; font-weight:600;}
.zt6 {font-size:14px; font-weight:600;}
.zt7 {text-align:right; color:#000000;}
.zt8 {text-align:right; color:#000000;}
.spmenu { line-height:28px; text-align:center;margin-bottom:10px; border-color:#999999;}
.menu_bg {background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cf994b 1px solid;}
.menu_bg1 { background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-right:20px;border-bottom:#cf994b 1px solid; height:28px;}
.menu_bg2 {background-color:#cccccc;text-align:left;margin:10px 0 10px 0;height:20px;padding-top:10px;border:#CCCCCC 0px solid; font-size:12px;padding-left:20px;}
.menu_bg4 {background-color:#cccccc;text-align:left;margin:10px 0 10px 0;padding-top:5px;padding-bottom:5px;border:#CCCCCC 0px solid; font-size:12px;padding-left:20px;}
.tb {width: 90%; background-color:#999999;}
.tb1 {width: 90%; background-color:#999999; margin-top:10px;}
.tb2 {width: 1050px; background-color:#999999;}
.tb3 {width: 980px; background-color:#999999;}
.left {float:left; clear:right;}
.k1 {float:left;width:90%; background-color:#efefef; border:#999999 1px solid;padding-top:10px;}
.k2 {float:left; width:90%; line-height:28px; margin-top:10px;}
.k3 {float:left; width:90%; line-height:28px; margin-top:10px; padding-bottom:30px; clear:both;}
.btlj1 {background: url(../Include/Images/bt1.gif) no-repeat; width:74px; height:23px;text-align:center; padding-top:5px; font-size:12px; display:inline; float:left;margin-left:5px;}
.btlj1 a{color:#000000; text-decoration:none;}
.btlj1 a:hover{color:#FF3300;text-decoration:underline;}
.hidden{visibility:hidden;}
a.lj {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:link {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:visited {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:hover {color:#ff3300;}
a.lj:active {color:#ff3300;}
.bk_left {border-bottom:#999999 1px solid;border-right:#999999 1px solid;border-left:#999999 1px solid;border-top:#999999 0px solid;}
.bk_middle {border-bottom:#999999 1px solid;border-right:#999999 1px solid;border-left:#999999 0px solid;border-top:#999999 0px solid;}
h2 {padding-left:20px;padding-top:10px;margin:0; background: url(../Include/Images/menu_title.gif) repeat-x;height:21px;font-size:14px; font-weight:600;}
.jiacu {font-weight:bold;}
.menu_bg3 { background-color:#f5f5f5; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cccccc 1px solid;border-top:#cccccc 1px solid;clear:left;}
</style>
    <script type="text/javascript">
        function CloseWindow()
        {
            if(confirm("确定要取消并关闭窗口吗？"))
            {
                window.close();
            }
            else
            {
                return;
            }
        }
        function CountTotal()
       {
           
           var orderPayDetailCount = document.getElementById("hidOrderPayDetailCount").value;
           var returnDocPayDetailCount = document.getElementById("hidReturnDocPayDetailCount").value;
           var hidReverseAmount  = document.getElementById("hidReverseAmount");
           var hidReturnAmount = document.getElementById("hidReturnAmount");
           var hidReturnTotal = document.getElementById("hidReturnTotal");
           var txtReverseAmount = document.getElementById("txtReverseAmount");
           var txtReturnAmount = document.getElementById("txtReturnAmount");
           var txtReturnTotal = document.getElementById("txtReturnTotal");
           var totalReverseAmount = 0;
           var totalReturnAmount = 0;
           var totalReturnTotal = 0;
           
           for(var i=1;i<=orderPayDetailCount;i++)
           {
                if(i<10)
                {
                    var returnAmountControlId = "dlistPayDetail_ctl0" + i + "_txtReturnAmount";
                    var returnAmount = document.getElementById(returnAmountControlId).value;
                    
                    totalReverseAmount += returnAmount*1.00;
                }
                else
                {
                    var returnAmountControlId = "dlistPayDetail_ctl" + i + "_txtReturnAmount";
                    var returnAmount = document.getElementById(returnAmountControlId).value;
                    
                    totalReverseAmount += returnAmount*1.00;
                }
                
           }
           
           for(var i=1;i<=returnDocPayDetailCount;i++)
           {
                if(i<10)
                {
                    var payAmountControlId = "dlistPayDocPayDetail_ctl0" + i + "_txtPayAmount";
                    var payAmount = document.getElementById(payAmountControlId).value;
                    
                    totalReturnAmount += payAmount*1.00;
                }
                else
                {
                    var payAmountControlId = "dlistPayDocPayDetail_ctl" + i + "_txtPayAmount";
                    var payAmount = document.getElementById(payAmountControlId).value;
                    
                    totalReturnAmount += payAmount*1.00;
                }
           }
           
           txtReverseAmount.value = totalReverseAmount.toFixed(2);
           txtReturnAmount.value = totalReturnAmount.toFixed(2);
           totalReturnTotal = totalReverseAmount + totalReturnAmount;
           txtReturnTotal.value = totalReturnTotal.toFixed(2);
           
           hidReverseAmount.value = totalReverseAmount.toFixed(2);
           hidReturnAmount.value = totalReturnAmount.toFixed(2);
           hidReturnTotal.value = totalReturnTotal.toFixed(2);
       }
    </script>
</head>
<body  onload="CountTotal();">
    <form id="form1" runat="server">
    <div align="Justify">
        <h2>新增结算单</h2>
        <div class="menu_bg"><asp:Button ID="btnSubmit" runat="server" Text="保存" CssClass="input_button" OnClick="btnSubmit_Click" />
        <%--<input id="btnCancel" type="button" value="取消" class="input_button" onclick="CloseWindow()" />--%>
            <asp:Button ID="btnCancel" runat="server"  CssClass="input_button" Text="取消" OnClick="btnCancel_Click" />
        </div>    
        
        <div class="menu_bg3">　结算类型：<asp:DropDownList ID="dropSettlementType" CssClass="kuandu3" runat="server" Enabled="false">
            <asp:ListItem Value="001" Selected="True">应收款</asp:ListItem>
            <asp:ListItem Value="002">预收款</asp:ListItem>
        </asp:DropDownList>&nbsp;<br /> 
            <asp:Panel ID="Panel1" runat="server" Enabled="false">
                冲销金额：<asp:TextBox ID="txtReverseAmount" CssClass="kuandu5" runat="server" Text="0.00"></asp:TextBox>&nbsp;<br />
        　      退回金额：<asp:TextBox ID="txtReturnAmount" CssClass="kuandu5" runat="server"  Text="0.00"></asp:TextBox>&nbsp;<br />
                总退款金额：<asp:TextBox ID="txtReturnTotal" runat="server" CssClass="kuandu5"  Text="0.00"></asp:TextBox>&nbsp;
            </asp:Panel>
        　<br />
        　　　备注：<asp:TextBox ID="txtNotes" runat="server" Height="16px" Width="149px"></asp:TextBox></div>
        
        
           
        <div class="juli">
        
        <table style="background-color: #999999;" border="0" cellspacing="1" cellpadding="0">
                <tr class="z2">
                    <td class="zt5" width="120" style="height: 19px">退货单编号：

                    </td>
                    <td width="200" style="height: 19px">
                    <asp:Label ID="lbldm" runat="server" Text=''></asp:Label>
                    </td>
                    <td class="zt5" width="120" style="height: 19px">购买人：
                    </td>
                    <td style="width: 200px; height: 19px"><asp:Label ID="lblgmr" runat="server" Text=""></asp:Label>
                    </td>
                </tr>            
                    <tr class="z2">
                        <td class="zt5" width="120">
                            退货原因：
                        </td>
                        <td width="200">
                            <asp:DropDownList ID="DropDownList2" Width="126" runat="server" Enabled="false">
                            </asp:DropDownList>                            
                        </td>
                        <td class="zt5" width="120">
                            责任人：
                        </td>
                        <td width="200">
                            <asp:DropDownList ID="DropDownList3" Width="126" runat="server" Enabled="false">
                            </asp:DropDownList>                            
                        </td>
                    </tr>                  
                <tr class="z2">
                    <td class="zt5" width="120" style="height: 19px">关联订单：

                    </td>
                    <td width="200" style="height: 19px">
                    <asp:HyperLink ID="lblorder" runat="server" ForeColor="#ff9900"></asp:HyperLink>
                    </td>
                    <td class="zt5" width="120" style="height: 19px">退货人：

                    </td>
                    <td style="width: 200px; height: 19px">
                    <asp:TextBox ID="txtthr" runat="server" Width="111px" Enabled="false"></asp:TextBox></td>
                </tr>
                <tr class="z2">
                    <td class="zt5" style="height: 24px">物流公司：

                    </td>
                    <td style="height: 24px">
                    <asp:DropDownList ID="ddlwlgs" runat="server" Width="117px" Enabled="false">
                        </asp:DropDownList></td>
                    <td class="zt5" style="height: 24px">退货人电话：

                    </td>
                    <td style="width: 200px; height: 24px;">
                    <asp:TextBox ID="txtthrdh" runat="server" Width="111px" Enabled="false"></asp:TextBox></td>
                </tr>
                <tr class="z2">
                    <td class="zt5" style="height: 19px">物流费用：

                    </td>
                    <td style="height: 19px">
                    <asp:TextBox ID="txtwlfy" runat="server" Width="111px" Enabled="false"></asp:TextBox></td>
                    <td class="zt5" style="height: 19px">退货人手机：

                    </td>
                    <td style="width: 200px; height: 19px">
                    <asp:TextBox ID="txtthrsj" runat="server" Width="111px" Enabled="false"></asp:TextBox></td>
                </tr>
                <tr class="z2">
                    <td class="zt5" style="height: 19px"><%--费用性质：--%>

                    </td>
                    <td style="height: 19px">
                    <%--<asp:DropDownList ID="ddlfyxz" runat="server" Width="117px" Enabled="false">
                                                        <asp:ListItem Text="卖方承担" Value="001"></asp:ListItem>
                                <asp:ListItem Text="买方承担" Selected="true" Value="002"></asp:ListItem>
                        </asp:DropDownList>--%></td>
                    <td class="zt5" style="height: 19px">退货人邮编：

                    </td>
                    <td style="width: 200px; height: 19px">
                    <asp:TextBox ID="txtthryb" runat="server" Width="111px" Enabled="false"></asp:TextBox></td>
                </tr>
                <tr class="z2">
                    <td class="zt5" style="height: 24px">物流单号：

                        </td>
                    <td style="height: 24px"><asp:TextBox ID="Label7" runat="server" Text='' Width="111px" Enabled="false"></asp:TextBox>
                        </td>
                    <td class="zt5" style="height: 24px">退货人地址：

                    </td>
                    <td style="width: 200px; height: 24px">
                    <asp:TextBox ID="txtthrdz" runat="server" Width="111px" Enabled="false"></asp:TextBox></td>
                </tr>
                <tr class="z2">
                                   <td class="zt5" style="height: 20px">退款：

                    </td>
                    <td style="height: 20px"><asp:Label ID="Label13" runat="server" Text=''></asp:Label>
                    <td class="zt5" style="height: 20px">审核：

                    </td>
                    <td style="width: 200px; height: 20px"><asp:CheckBox ID="CheckBox1" runat="server" Enabled="false" />
                    </td>
                </tr>                
                <tr class="z2">
                              <td class="zt5" style="height: 20px">退积分：

                    </td>
                    <td style="height: 20px"><asp:Label ID="Label14" runat="server" Text=''></asp:Label>
                    <td class="zt5" style="height: 20px">结算：

                    </td>
                    <td style="width: 200px; height: 20px"><asp:CheckBox ID="CheckBox2" runat="server" Enabled="false" />
                    </td>
                </tr>      
                <tr class="z2">
                    <td class="zt5" rowspan="3">
                    备注：

                    </td>
                    <td rowspan="3">
                    <asp:TextBox TextMode="multiLine" runat="server" ID="Label9" Text=""></asp:TextBox>
                    </td>
                    <td class="zt5" style="height: 19px">已结算金额：

                    </td>
                    <td style="width: 200px; height: 19px">
                        <asp:Label ID="Label15" runat="server" Text=""></asp:Label></td>                    
                </tr>                                 
                <%--<tr class="z2">
                    <td class="zt5" style="height: 19px">退款方式：
                    </td>
                    <td style="width: 200px; height: 19px"><asp:Label ID="Label12" runat="server" Text=''></asp:Label>
                    </td>
                </tr>--%>
            
                <tr class="z2">
                    <td class="zt5" style="height: 20px">作废：

                    </td>
                    <td style="width: 200px; height: 20px;"><asp:CheckBox ID="CheckBox3" runat="server" Enabled="false" />
                    </td>
                </tr>                                
            </table>
        </div>
        <asp:Panel ID="pnlSecDeal" runat="server" Width="100%">
        <div class="menu_bg2"><span class="jiacu">担保交易支付明细</span></div>
        <div class="juli"><asp:DataList ID="dlistPayDetail" runat="server" CellPadding="0" OnItemDataBound="dlistPayDetail_ItemDataBound">
            <ItemTemplate>
                <table width="980" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="140" align="center" class="bk_left">
                            <asp:Label ID="lblDetailId" runat="server" Text='<%# Eval("PD_DETAILID")%>'></asp:Label>
                        </td>
                        <td width="140" align="center" class="bk_middle">
                            <%# Eval("DT_NAME")%>
                        </td>
                        <td width="140" align="center" class="bk_middle">
                            <%# Eval("PT_NAME")%>
                        </td>
                        <td width="140" align="right" class="bk_middle">
                            <asp:Label ID="lblDealId" runat="server" Text='<%#Eval("PD_DEALID") %>'></asp:Label>
                        </td>
                        <td width="140" align="right" class="bk_middle">    
                            <asp:Label ID="lblPayAmount" runat="server" Text='<%# Eval("PD_PAYAMT")%>'></asp:Label>
                        </td>
                        <td width="140" align="right" class="bk_middle">    
                            <asp:Label ID="lblReturnedAmount" runat="server" Text='<%# Eval("ReturnAmount")%>'></asp:Label>
                        </td>
                        <td align="center" class="bk_middle">
                            <asp:TextBox ID="txtReturnAmount" Width="90" CssClass="zt7" runat="server" Text="0.00" onkeyup="CountTotal()"></asp:TextBox> 
                        </td>
                    </tr>
                </table>     
            </ItemTemplate>
            <HeaderTemplate>
                <table class="tb3" border="0" cellspacing="1" cellpadding="0">
                    <tr class="z1">
                        <td class="zt3" width="140">
                            明细编号
                        </td>
                        <td class="zt3" width="140">
                            交易方式
                        </td>
                        <td class="zt3" width="140">
                            支付方式
                        </td>
                        <td class="zt3" width="140">
                            交易号
                        </td>
                        <td class="zt3" width="140">
                            应付金额
                        </td>
                        <td class="zt3" width="140">
                            已退款金额

                        </td>
                        <td class="zt3">
                            本次退款金额

                        </td>
                    </tr>
                </table>
            </HeaderTemplate>
        </asp:DataList></div>
        
        </asp:Panel>
        
        
        <br />
        <div class="menu_bg4"><asp:Button ID="btnAddPayDocPayDetail" runat="server" CssClass="input_button3" Text="添加支付明细" OnClick="btnAddPayDocPayDetail_Click" /></div>
        <div class="juli"><asp:DataList ID="dlistPayDocPayDetail" runat="server" OnItemDataBound="dlistPayDocPayDetail_ItemDataBound" OnItemCommand="dlistPayDocPayDetail_ItemCommand" CellPadding="0">
            <HeaderTemplate>
                <table class="tb2" border="0" cellspacing="1" cellpadding="0">
                    <tr class="z1">
                        <td class="zt3" width="60">
                            删除
                        </td>
                        <td class="zt3" width="70">
                            交易类型
                        </td>
                        <td class="zt3" width="110">
                            支付方式
                        </td>
                        <td class="zt3" width="100">
                            支付金额
                        </td>
                        <td class="zt3" width="135">
                            支付日期
                        </td>
                        <td class="zt3" width="135">
                            交易号

                        </td>
                        <td class="zt3" width="135">
                            交易日期
                        </td>
                        <td class="zt3" width="135">
                            帐号
                        </td>
                        <td class="zt3">
                            备注
                        </td>
                    </tr>
                </table>
            </HeaderTemplate>
            <ItemTemplate>
                <table width="1050" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="60" align="center" class="bk_left">
                            <asp:Button ID="btnDelete" CssClass="input_button" runat="server" Text="删除" CommandName="Del" />
                        </td>
                        <td width="70" align="center" class="bk_middle">
                            <asp:DropDownList ID="dropDealType" runat="server" Width="55"  AutoPostBack="true" OnSelectedIndexChanged="DataList2_DDLCHANGE_Click">
                            <asp:ListItem Text="即时到帐" Value="001"></asp:ListItem>
                            <asp:ListItem Text="担保交易" Value="002"></asp:ListItem>
                            <asp:ListItem Text="结余款" Value="003"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td width="110" align="center" class="bk_middle">
                            <asp:DropDownList ID="dropPayType" Width="105" runat="server">
                            </asp:DropDownList>
                        </td>
                        <td width="100" align="center" class="bk_middle">
                            <asp:TextBox ID="txtPayAmount" CssClass="zt7" Width="60" runat="server" Text='<%# Eval("RDPD_PAYAMT")%>' onkeyup="CountTotal()"></asp:TextBox>
                        </td>
                        <td width="135" align="center" class="bk_middle">
                            <asp:TextBox ID="txtPayDate" CssClass="kuandu2" Width="124" runat="server" Text='<%# Convert.ToDateTime(Eval("RDPD_PAYDATE")).ToShortDateString()%>' OnClick="setday(this)" ></asp:TextBox>
                        </td>
                        <td width="135" align="center" class="bk_middle">
                            <asp:TextBox ID="txtDealID" CssClass="kuandu2" Width="124" runat="server" Text='<%# Eval("RDPD_DEALID")%>'></asp:TextBox>
                        </td>
                        <td width="135" align="center" class="bk_middle">
                            <asp:TextBox ID="txtDealDate" CssClass="kuandu2" Width="124" runat="server" Text='<%# Convert.ToDateTime(Eval("RDPD_DEALDATE")).ToShortDateString()%>' OnClick="setday(this)"></asp:TextBox>
                        </td>
                        <td width="135" align="center" class="bk_middle">
                            <asp:TextBox ID="txtAccount" CssClass="kuandu2" Width="124" runat="server" Text='<%# Eval("RDPD_ACCOUNT")%>'></asp:TextBox>
                        </td>
                        <td align="center" class="bk_middle">
                            <asp:TextBox ID="txtNotes" CssClass="kuandu3" Width="150" runat="server" Text='<%# Eval("RDPD_NOTE")%>'></asp:TextBox>
                        </td>
                    </tr>
                </table>
            </ItemTemplate>
        </asp:DataList>
        </div>
        <input id="hidReverseAmount" type="hidden" runat="server" />
        <input id="hidReturnAmount" type="hidden" runat="Server" />
        <input id="hidReturnTotal" type="hidden" runat="Server" />
        <input id="hidOrderPayDetailCount" type="hidden" runat="Server" />
        <input id="hidReturnDocPayDetailCount" type="hidden" runat="Server" />
        </div>
    </form>
</body>
</html>
